import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const routes = [{
    path: "/",
    redirect: '/ResourceManagement',
  },
  {
    path: "/ResourceManagement",
    name: "ResourceManagement",
    component: () => import("../views/ResourceManagement2.vue"),
  },
  // {
  //   path: "/Configuration",
  //   name: "Configuration",
  //   component: () => import("../views/Configuration.vue"),
  // },
  // {
  //   path: "/DataManagement",
  //   name: "DataManagement",
  //   component: () => import("../views/DataManagement.vue"),
  // }, {
  //   path: "/PublishOperator",
  //   name: "PublishOperator",
  //   component: () => import("../views/PublishOperator.vue"),
  // },
  // {
  //   path: "/DatabaseStatistics",
  //   name: "DatabaseStatistics",
  //   component: () => import("../views/DatabaseStatistics.vue"),
  // },
  // {
  //   path: "/CodeMirror",
  //   name: "CodeMirror",
  //   component: () => import("../components/CodeMirror/CodeMirror.vue"),
  // },

  // {
  //   path: "/demoTree3",
  //   name: "demoTree3",
  //   component: () => import("../views/demoTree3.vue"),
  // },
  // {
  //   path: "/",
  //   name: "dataStatistics",
  //   component: () => import("../views/dataStatistics.vue"),
  // },
];

const router = new VueRouter({
  mode: "hash",
  scrollBehavior() {
    //切换路由滚动条置顶
    return {
      x: 0,
      y: 0,
    };
  },
  routes,
});
router.originalPush = originalPush
export default router;